package com.practice.mybatis.v2.executor;

import com.practice.mybatis.v2.config.Configuration;
import com.practice.mybatis.v2.config.MapperRegistory.MapperData;
import com.practice.mybatis.v2.statement.StatementHandler;

public class SimpleExecutor implements Executor{
	
	private Configuration configuration;

	public SimpleExecutor(Configuration configuration) {
		this.configuration = configuration;
	}

	public Configuration getConfiguration() {
		return configuration;
	}

	@Override
	public <T> T query(MapperData<T> mapperData, Object parameter) {
		StatementHandler handler = new StatementHandler(configuration);
		return (T) handler.query(mapperData, parameter);
	}
	
}
